#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,s[20000]; 
int main(){
	ios::sync_with_stdio(0);
  	freopen("rotate.in","r",stdin);
  	freopen("rotate.out","w",stdout);
	cin>>n;
	for(int i=1;i<=n;i++)cin>>s[i];
	vector<int> v;
	cout<<2<<' ';
	for(int i=1;i<=n;i++){
		for(int j=i;j-1;j--){
			if(s[j]<s[j-1]){
				swap(s[j],s[j-1]);
				v.push_back(j-1);
			}else break;
		}
	}
	cout<<v.size()<<'\n';
	for(int i:v)cout<<1<<' '<<i<<'\n';
}
